package com.sky.controller.user;

import com.sky.entity.Setmeal;
import com.sky.result.Result;
import com.sky.service.SetmealService;
import com.sky.vo.DishItemVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * ClassName: SetmealController
 * Package: com.sky.controller.user
 * Description:套餐
 * @Author: Zhang Peiyuan
 * @Create: 2024-12-21-19:57
 * @Version: v1.0
 */
@RestController("userSetmealController")
@RequestMapping("/user/setmeal")
public class SetmealController {
    @Resource
    private SetmealService setmealService;

    @GetMapping("/list")
    public Result<List<Setmeal>> querySetmealList(@RequestParam(value="categoryId") Long categoryId) {
        return Result.success(setmealService.querySetmealList(categoryId));
    }


    /**
     * 根据套餐id查询包含的菜品
     * @param id
     * @return
     */
    @GetMapping("/dish/{id}")
    public Result<List<DishItemVO>> querySetmeal(Long id) {
        return Result.success(setmealService.querySetmealOfDish(id));
    }
}
